/*
 * Print.h
 *
 *  Created on: 26-10-2011
 *      Author: cristian
 */

#ifndef PRINT_H_
#define PRINT_H_

#include "Logger.h"
#include "AmbienteWorker.h"
#include "Worker.h"
#include <typeinfo>

class Print {

private:
	Logger* logger;
public:
	Print();
	virtual ~Print();
	void printConsola(AmbienteWorker* ambiente);

};


void Print::printConsola(AmbienteWorker* ambiente) {



	for (int f = 0; f < ambiente->x(); f++) {
		for (int c = 0; c < ambiente->y(); c++) {


//			switch (m[f][c]) {
//			case 0:
//				printf(". ");
//				break;
//			case 1:
//				printf("\033[36m* ");
//				break;
//			case 2:
				if (typeid(ambiente->getWorker(f,c)) == typeid(Worker*) && ambiente->getWorker(f,c) != NULL){
					//printf("%s(%s) ",ANSI_RED ,((Worker*)ambiente->getNodo(f,c))->getNombre().c_str() );
					printf("%s%s%i ",ANSI_RED,ANSI_BACKGROUND_WHITE ,(ambiente->getWorker(f,c)->getId()));
					printf("%s", ANSI_RESET);
					fflush(stdout);
				}else{
					//printf("(%i,%i) ",f,c);
					printf("%s%s ",ANSI_BLUE,"#");
					printf("%s", ANSI_RESET);
					fflush(stdout);
				}

//				break;
//			default:
//				break;
//			}
		}

		printf("\n");
	}

}



Print::Print() {
	this->logger = new Logger();

}

Print::~Print() {
	delete this->logger;
}

#endif /* PRINT_H_ */
